﻿namespace MSU_Broker
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    [global::System.Serializable]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    public class MSU_Exception : Exception
    {
        private MSU_Error errorType;

        private string retrievedStackTrace = "";

        private MSU_Exception retrievedInnerException = null;

        public MSU_Exception RetrievedInnerException
        {
            get { return retrievedInnerException; }
            set { retrievedInnerException = value; }
        }

        public string RetrievedStackTrace
        {
            get { return retrievedStackTrace; }
            set { retrievedStackTrace = value; }
        }

        public MSU_Error ErrorType
        {
            get { return errorType; }
            set { errorType = value; }
        }

        public MSU_Exception()
        {
            this.errorType = MSU_Error.UNEXPECTED_ERROR;
        }

        public MSU_Exception(string message, MSU_Error errorType) : base(message)
        {
            this.errorType = errorType;
        }

        public MSU_Exception(string message, MSU_Error errorType, MSU_Exception inner) : base(message, inner)
        {
            this.errorType = errorType;
        }

        public MSU_Exception(string message, MSU_Error errorType, Exception inner) : base(message, inner)
        {
            this.errorType = errorType;
        }

        protected MSU_Exception(
            System.Runtime.Serialization.SerializationInfo info,
            System.Runtime.Serialization.StreamingContext context)
            : base(info, context) { }
    }
}
